<template>
<div>
  <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
 <van-swipe-item
 v-for="(item,index) in gteimg"
 :key="index">
 <img :src="item" alt="">
 </van-swipe-item>
</van-swipe>
<div class="ssk">
  <div class="cs" @click="cs">{{title=city?city:"深圳"}}▼</div>
  <van-search v-model="value" background="transparent" placeholder="请输入小区地址"  />
  <div class="dt">
    <van-icon name="map-marked" size="25" color="#fdfeff"/>
  </div>
</div>
<div class="lb">
  <ul>
    <li><img src="" alt=""><p class="p1">整租</p></li>
    <li><img src="" alt=""><p class="p1">合租</p></li>
    <li><img src="" alt=""><p class="p1">地图找房</p></li>
    <li><button @click="btn4"><img src="" alt=""><p class="p1">去出租</p></button></li>
  </ul>
</div>
<div class="zfxz">
  <div class="text">
    <strong>租房小组</strong>
    <p class="gd">更多</p>
  </div>
  <div class="div1">
    <img :src="listImg[0]" alt="">
    <div class="wz">
      <p>{{list[0].title}}</p>
      <p>{{list[0].desc}}</p>
    </div>
  </div>
    <div class="div2">
    <img :src="listImg[1]" alt="">
    <div class="wz">
      <p>{{list[1].title}}</p>
      <p>{{list[1].desc}}</p>
    </div>
  </div>  <div class="div1">
    <img :src="listImg[2]" alt="">
    <div class="wz">
      <p>{{list[2].title}}</p>
      <p>{{list[2].desc}}</p>
    </div>
  </div>  <div class="div3">
    <img :src="listImg[3]" alt="">
    <div class="wz">
      <p>{{list[3].title}}</p>
      <p>{{list[3].desc}}</p>
    </div>
  </div>
 </div>
</div>
</template>

<script>
import { getLbt, Zfxz } from '../api/article'
export default {
  data () {
    return {
      value: '',
      gteimg: [],
      list: [],
      listImg: [],
      city: localStorage.getItem('city') || ''
    }
  },
  methods: {
    btn4 () {
      this.$router.push('/fbfy')
    },
    cs () {
      this.$router.push('/citylist')
    }
  },
  async created () {
    const res = await getLbt()
    const Res = await Zfxz()
    // console.log(Res)
    this.list = Res.body
    Res.body.forEach(item => {
      this.listImg.push(`http://liufusong.top:8080${item.imgSrc}`)
    })
    console.log(this.listImg)
    // console.log(res)
    res.body.forEach(item => {
      this.gteimg.push(`http://liufusong.top:8080${item.imgSrc}`)
    })
    // console.log(this.gteimg)
  }
}
</script>

<style lang="less" scoped>
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 150px;
  height: 212px;
  text-align: center;
  background-color: #39a9ed;
 }
 img {
  width: 375px;
  height: 212px;
 }

 //四个块图片
.div1{
  width: 172px;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 5px ;
  background-color: #fff;
  img{
    width: 60px;
    margin-right: 20px;
    height: 60px;
  }
}
.div2{
  width: 172px;
  height: 60px;
  float: right;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: -65px;
  background-color: #fff;
  img{
    width: 60px;
    height: 60px;
    margin-right: 20px;

}
}
.div3{
  width: 172px;
  height: 60px;
  float: right;
  display: flex;
  margin-top: -65px;
  justify-content: center;
  align-items: center;
  background-color: #fff;
  img{
    width: 60px;
    height: 60px;
    margin-right: 20px;
}
}
 .ssk{
  position: absolute;
  margin-top: -180px;
  margin-left: 5%;
  height: 34px;
  width: 90%;
display: flex;
justify-content: center;
align-items: center;
}
.cs{
background-color: #fff;
  height: 34px;
  line-height: 34px;
  width: 60px;
  margin-right: -13px;
  text-align: center;
}
.lb ul li{
  width: 25%;
  text-align: center;
  margin-top: 20px;
  img{width: 60px;
  height: 60px;
  }
  .p1{
    margin-top: 5px;
  }
}
.lb ul{
  display: flex;
  justify-content: center;
}
.text{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 15px;
}
.zfxz{
  background-color:#f6f5f6;
  height: 187px;

}
button{
  border: none;outline: none;
  background-color: transparent;
}
</style>
